package com.googlecode.flightreports.flightlist;

import java.util.Date;
import java.util.List;
import org.xml.sax.InputSource;  // report is used as a SAX input stream

/**
 * This bean holds the data values needed for this report
 * 
 */
public class ReportObject extends InputSource {
    private Date runDate;
    
    // query params for this report
    private ReportParams queryParams;

    public ReportParams getQueryParams() {
        return queryParams;
    }

    public void setQueryParams(ReportParams queryParams) {
        this.queryParams = queryParams;
    }

    private List<Item> itemList =
        new java.util.ArrayList<Item>();
     
    public void addItem(Item item) {
        itemList.add(item);
    }

    public List getItems() {
        return itemList;
    }

    public void setItems(List<Item> items) {
            this.itemList = items;
    }

    public Date getRunDate() {
            return runDate;
    }

    public void setRunDate(Date runDate) {
            this.runDate = runDate;
    }   

    /**
     * This object represents a single item of this report,
     * usually rendered as a single-row in a report.
     */
    public static class Item {
        private String flightNumber;
        private String origin;
        private String destination;
        private String departTime;
        private String arriveTime;
        private int miles;
        private int numberOfSegments;
        private String aircraftType;

        public String getFlightNumber() {
            return flightNumber;
        }

        public void setFlightNumber(String flightNumber) {
            this.flightNumber = flightNumber;
        }

        public String getOrigin() {
            return origin;
        }

        public void setOrigin(String origin) {
            this.origin = origin;
        }

        public String getDestination() {
            return destination;
        }

        public void setDestination(String destination) {
            this.destination = destination;
        }

        public String getDepartTime() {
            return departTime;
        }

        public void setDepartTime(String departTime) {
            this.departTime = departTime;
        }

        public String getArriveTime() {
            return arriveTime;
        }

        public void setArriveTime(String arriveTime) {
            this.arriveTime = arriveTime;
        }

        public int getMiles() {
            return miles;
        }

        public void setMiles(int miles) {
            this.miles = miles;
        }

        public int getNumberOfSegments() {
            return numberOfSegments;
        }

        public void setNumberOfSegments(int numberOfSegments) {
            this.numberOfSegments = numberOfSegments;
        }

        public String getAircraftType() {
            return aircraftType;
        }

        public void setAircraftType(String aircraftType) {
            this.aircraftType = aircraftType;
        }
        
        @Override
        public String toString() {
            StringBuffer buffer = new StringBuffer();
            buffer.append("AirlineFlight[");
            buffer.append("flightNumber = ").append(flightNumber);
            buffer.append(" origin = ").append(origin);
            buffer.append(" destination = ").append(destination);
            buffer.append(" departTime = ").append(departTime);
            buffer.append(" arriveTime = ").append(arriveTime);
            buffer.append(" miles = ").append(miles);
            buffer.append(" numberOfSegments = ").append(numberOfSegments);
            buffer.append(" aircraftType = ").append(aircraftType);
            buffer.append("]");
            return buffer.toString();
        }
        
    }   
}
